package cooperate

import (
	"google.golang.org/grpc"

	"git.internal.yunify.com/benchmark/benchmark/pkg/boot"
	"git.internal.yunify.com/huangyingjun/qingbilling-gateway/api/generate/pb"
	"git.internal.yunify.com/huangyingjun/qingbilling-gateway/internal/apps/cooperate/app/service"
	"git.internal.yunify.com/huangyingjun/qingbilling-gateway/internal/constants"
	config2 "git.internal.yunify.com/huangyingjun/qingbilling-gateway/internal/pkg/config"
)

func Start() (err error) {
	//注册grpc服务
	register := func(gs *grpc.Server) { pb.RegisterNewBillingGatewayManagerServer(gs, service.NewBillingGatewayService{}) }

	return boot.NewGrpcServer(constants.ServiceCooperate, constants.ServiceCooperatePort, config2.ConfigFilePath(), register).
		//引入数据库
		//WithComponents(global.Pgsql(pgsql.WithDbName(constants.ServiceCooperate))).
		//WithComponents(global.Mysql(mysql.WithDbName("test333"))).
		//启动
		Run()
}
